package com.syg;

import com.syg.boot.core.builder.SygSpringApplicationBuilder;
import com.syg.boot.util.net.NetUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.util.StringUtils;

/**
 * @author syg
 * @version 1.0
 * @date 2021年11月24日15:03:48
 */
@SpringBootApplication
public class Boot {
    private static final Logger log = LoggerFactory.getLogger(NetUtil.class);
    public static void main(String[] args) {


        try {
            SpringApplicationBuilder builder = new SygSpringApplicationBuilder(Boot.class);
            ApplicationContext context = builder.web(WebApplicationType.SERVLET).run(args);
            String[] activeProfiles = context.getEnvironment().getActiveProfiles();
            log.info("---------ActiveProfiles--------- " + StringUtils.arrayToCommaDelimitedString(activeProfiles));
        } catch (Exception e) {
            // 一定要加此try catch, 方便解决问题,打印启动失败的错误信息
            log.error("Application Start Exception", e);
        }
    }
}
